﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter11.Code02.Code01
{
    public class Demo
    {
        public static void Begin()
        {
            {
                MyComplexClass myObj = new MyComplexClass();
                if (myObj.GetType() == typeof(MyComplexClass))
                {

                }
            }
            {
                MyStruct valType1 = new MyStruct();
                valType1.Val = 5;
                object refype = valType1;
                valType1.Val = 6;
                MyStruct valType2 = (MyStruct)refype;
                Console.WriteLine("valType2.Val = {0}", valType2.Val);
                Console.ReadLine();
            }
            {
                MyClass refType1 = new MyClass();
                refType1.Val = 5;
                object refType = refType1;
                refType1.Val = 6;
                MyClass refType2 = (MyClass)refType;
                Console.WriteLine("refType2.Val = {0}", refType2.Val);
                Console.ReadLine();
            }
            {
                MyStruct valType1 = new MyStruct();
                IMyinterface refType = valType1;
                MyStruct valType2 = (MyStruct)refType;
                Console.WriteLine("valType2.Val = {0}", valType2.Val);
                Console.ReadLine();
            }
        }
    }
}
